﻿using Cl.Model.DataBaseEntityDtos.User.User;
using Cl.Model.Results;
using Cl.WebApi.SwaggerModel;
using Microsoft.AspNetCore.Mvc;

// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860

namespace Cl.WebApi.Areas.Other.Test
{
    /// <summary>
    /// 符合restful标准的api接口
    /// </summary>
    [Route("api/[controller]")]
    [ApiController]
    [ApiExplorerSettings(GroupName = Grouping.OpenGroup)]
    public class RestfulApiController : Controller
    {
        /// <summary>
        /// 构造函数
        /// </summary>
        public RestfulApiController()
        {

        }

        /// <summary>
        /// 查询表列表
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public PageResultModel<UserOutDto> Get([FromQuery] SearchUserDto request)
        {
            return new PageResultModel<UserOutDto>() { };
        }

        /// <summary>
        /// 查找表列表
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [HttpGet("{id}")]
        public UserOutDto Get(int id)
        {
            return new UserOutDto();
        }

        /// <summary>
        /// 保存表
        /// </summary>
        /// <param name="value"></param>
        [HttpPost]
        public ResultInfoModel Post([FromBody] UserInputDto value)
        {
            return GetResult.Success();
        }

        /// <summary>
        /// 更新表
        /// </summary>
        /// <param name="value"></param>
        [HttpPut]
        public ResultInfoModel Put([FromBody] UserInputDto value)
        {
            return GetResult.Success();
        }

        /// <summary>
        /// 删除表
        /// </summary>
        /// <param name="id"></param>
        [HttpDelete]
        public ResultInfoModel Delete([FromBody] List<int> id)
        {
            return GetResult.Success();
        }

        /// <summary>
        /// 删除表
        /// </summary>
        /// <param name="id"></param>
        [HttpDelete("{id}")]
        public ResultInfoModel Delete(int id)
        {
            return GetResult.Success();
        }
    }
}
